package com.akk.business;

import com.akk.module.avs.entity.AvsYbBank;
import com.akk.module.avs.entity.AvsYbInfo;
import com.akk.module.avs.service.AvsYbBankService;
import com.akk.module.avs.service.AvsYbInfoService;
import com.akk.utils.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class AvsYbBankBusiness {

    @Autowired
    private AvsYbBankService bankService;

    @Autowired
    private AvsYbInfoService infoService;

    public RestResponse bankList(String appId){
        Map params = new HashMap();
        params.put("appId",appId);
        params.put("type","bankList");
        List<AvsYbBank> list = bankService.queryByParams(params);
        return RestResponse.build(list);
    }

    public RestResponse queryBankList(String appId){
        Map params = new HashMap();
        params.put("appId",appId);
        params.put("type","queryBankList");
        List<AvsYbBank> list = bankService.queryByParams(params);
        return RestResponse.build(list);
    }

    public RestResponse info(String appId){
        Map params = new HashMap();
        params.put("appId",appId);
        List<AvsYbInfo> list = infoService.queryByParams(params);
        if (list.size() == 0)
            return RestResponse.build("1","OEM信息尚未完善，请管理员登录后台录入信息");
        return RestResponse.build(list.get(0));
    }

}
